package com.qcby.controller;


import com.qcby.entity.Result;
import com.qcby.entity.Student;
import com.qcby.service.MessageService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping("/message")
public class MessageController {
    @Autowired
    public MessageService messageService;

    @ApiModelProperty("查找某学生聊天信息")
    @PostMapping("/SearchMessage")
    @ResponseBody
    @ApiImplicitParams({
            @ApiImplicitParam(value = "name",name = "name",dataType = "String")
    })
    public Result SearchMessage(String name){
        Student student = new Student();
        student.setName(name);
        return Result.success(messageService.SearchMessage(name));
    }

    @ApiModelProperty("查找某学生接收的聊天信息")
    @PostMapping("/SearchMessageToStudent")
    @ResponseBody
    @ApiImplicitParams({
            @ApiImplicitParam(value = "name",name = "name",dataType = "String")
    })
    public Result SearchMessageToStudent(String name){
        return Result.success(messageService.SearchMessageToStudent(name));
    }



}
